﻿<WindowView 
    x:Class="Poet.Views.AssociationView"
    Icon="/Poet;component/App.ico"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    WindowStartupLocation="CenterOwner"
    ResizeMode="CanResizeWithGrip"
    ShowInTaskbar="False"
    Title="Poet" 
    Height="400" Width="400">

    <WindowView.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\Resources\XamlStore.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
                <Setter Property="Margin" Value="2"/>
            </Style>
        </ResourceDictionary>
    </WindowView.Resources>

    <Grid>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <!--<ListView ItemsSource="{Binding Associations}">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="{Localizing IsAssotiated}">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding IsAssotiated, Mode=TwoWay,  UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="{Localizing Extension}" DisplayMemberBinding="{Binding ExtensionInfo.Extension}" />
                    <GridViewColumn Header="{Localizing PerceivedType}" DisplayMemberBinding="{Binding ExtensionInfo.PerceivedType}"/>
                </GridView>
            </ListView.View>
        </ListView>-->
        <GroupBox Header="{Localizing Association}" Margin="4,4,4,8">
        <DataGrid Grid.Column="0" Name="ExtensionDataGrid" ItemsSource="{Binding Items}" AutoGenerateColumns="False" SelectionChanged="Selector_OnSelectionChanged">
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="{Localizing IsAssotiated}" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding IsAssotiated, Mode=TwoWay,  UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="{Localizing Extension}" Binding="{Binding ExtensionInfo.Extension}" IsReadOnly="True"/>
            </DataGrid.Columns>
        </DataGrid>
        </GroupBox>   
        
        <StackPanel  Grid.Column="1" Margin="4">
                <GroupBox Header="{Localizing Filter}">
                   <TextBox Text="{Binding Filter, UpdateSourceTrigger=PropertyChanged}"/> 
                </GroupBox>

                <GroupBox Header="{Localizing Association}">
                    <StackPanel>
                        <Button Content="{Localizing CheckSelected}" Command="SelectionCommands.CheckSelected"/>
                        <Button Content="{Localizing UncheckSelected}" Command="SelectionCommands.UncheckSelected"/>
                        <Button Content="{Localizing CheckAll}" Command="SelectionCommands.CheckAll"/>
                        <Button Content="{Localizing UncheckAll}" Command="SelectionCommands.UncheckAll"/>
                    </StackPanel>
                </GroupBox>

            <GroupBox Header="{Localizing Extension}">
                <StackPanel>
                    <TextBox Text="{Binding ExtensionToAddOrRemove, UpdateSourceTrigger=PropertyChanged}"/>
                    <Button Content="{Localizing Add}" Command="{Binding Add}"/>
                    <Button Content="{Localizing Remove}" Command="{Binding Remove}"/>
                </StackPanel>
            </GroupBox>
            
        </StackPanel>
        
        <StatusBar Grid.ColumnSpan="2" Grid.Row="2"  Height="21" VerticalAlignment="Bottom"/>
    </Grid>
</WindowView>
